/*------------------------------------------------
<> GDI_FRAME_BUFFER class
<> 2008.07.31 - Robert Vanca
<> v0.2

A 24bit frame buffer implementation over windows GDI.
Features:
	- Pixel drawing with and without alpha blending
	
--------------------------------------------------*/
#pragma once
#ifndef _BASELIB_PAL_WINDOWS_GDI_FRAMEBUFFER_H
#define _BASELIB_PAL_WINDOWS_GDI_FRAMEBUFFER_H

class GDI_FRAME_BUFFER : public FRAME_BUFFER
{
public:
	HWND	hWnd; //main window handler
	HDC		hdc; //internal DC, used for rendering
	HDC		mainHdc; //external DC, the DC of the main window
	PAINTSTRUCT ps;
	HBITMAP theDIB;
	BITMAPINFO bmi;

	void*   thepixels; //the frame buffer
	COLOR*	backbuffer; //the back buffer, used to clear the screen in one pass
	
	int width;
	int height;
	
public:
	GDI_FRAME_BUFFER(int,int);
	~GDI_FRAME_BUFFER();
	
	void Draw();
	void Clear();
	inline int GetWidth() {return width;}
	inline int GetHeight() {return height;}
	inline void PutPixel(COLOR,int,int);
	inline void PutPixelAlpha(COLOR,int,int,float);
	inline void BlitMem(int,int,int,int,void*);
	COLOR GetPixel(int,int);
	
};

#endif //_BASELIB_PAL_WINDOWS_GDI_FRAMEBUFFER_H